package com.example.day8view;

import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.widget.LinearLayout;

public class TLayout extends LinearLayout {
    private static final String TAG = "TAG";
    public TLayout(Context context) {
        super(context);
    }

    public TLayout(Context context, AttributeSet attrs) {
        super(context, attrs);
    }


    //分发        //决定事件的传递方向
    //   return super.dispatchTouchEvent(ev);  ---->向上传递交给父类来解决
    //return true; -------->不向下分发,不向上传递，自己处理整个事件
    //return false  -------->不向下分发，向上传递
    @Override
    public boolean dispatchTouchEvent(MotionEvent ev) {
        Log.i(TAG, "dispatchTouchEvent: -----t");
        return super.dispatchTouchEvent(ev);
    }

    //拦截
    //return super.onInterceptTouchEvent(ev);  交给父容器决定
    //return true;   不传给子容器
    //return false;  不拦截
    @Override
    public boolean onInterceptTouchEvent(MotionEvent ev) {
        Log.i(TAG, "onInterceptTouchEvent: -----t");
        return false;
    }

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        Log.i(TAG, "onTouchEvent: -----t");
        return super.onTouchEvent(event);
    }
}
